//
//  DetailCommentModel.swift
//  Venus
//
//  Created by qurongxiang on 2018/7/25.
//  Copyright © 2018年 zhaowang. All rights reserved.
//


import Foundation
import SwiftyJSON


class SchoolDetailCommentModel: NSObject {
    var content : String = ""
    var createTime : String = ""
    var id : Int = 0
    var institutionId : Int = 0
    var resource : [SchoolDetailCommentModelResourceModel] = [SchoolDetailCommentModelResourceModel]()
    var score : String = ""
    var user : SchoolDetailCommentModelUserModel!
    var cellHeight:CGFloat = 0
    
    
    init(fromJson json: JSON!){
        if json.isEmpty{
            return
        }
        content = json["content"].stringValue
        createTime = json["createTime"].stringValue
        id = json["id"].intValue
        institutionId = json["institutionId"].intValue
        
        let resourceArray = json["resource"].arrayValue
        for resourceJson in resourceArray{
            let value = SchoolDetailCommentModelResourceModel(fromJson: resourceJson)
            resource.append(value)
        }
        score = json["score"].stringValue
        let userJson = json["user"]
        if !userJson.isEmpty{
            user = SchoolDetailCommentModelUserModel(fromJson: userJson)
        }
    }
    
}


/// 图片模型
class SchoolDetailCommentModelResourceModel: NSObject{
    var path :String = ""
    init(fromJson json: JSON!){
        if json.isEmpty{ return }
        path = json["path"].stringValue
    }
}







class SchoolDetailCommentModelUserModel : NSObject {
    
    var headImg : String = ""
    var userName : String = ""
    var createTime : String = ""
    
    init(fromJson json: JSON!){
        if json.isEmpty{ return }
        headImg = json["headImg"].stringValue
        userName = json["userName"].stringValue
        createTime = json["createTime"].stringValue
    }
}
